ig.module( 
	'game.gameTypes.gamePickInside' 
)
.requires(
	'impact.game',
	'game.gameTypes.gameBase',
	'game.entities.base.pickObject'	
)
.defines(function()
{
    GamePickInside = GameBase.extend(
    {
	font: new ig.Font( 'media/fonts/arialRounded.png' ),
	
        init: function()
        {
	    this.parent();
	    this.defaultValues();
        },
        
	defaultValues: function()
	{
	    ig.global.numberOfPicks = 0
	    ig.global.failed = false;

	    ig.global.typeToPick = 'all';
	    ig.global.mathOperator = '-';
	    
	    ig.global.failed = false;
	    ig.global.paused = false;
	    ig.global.desiredValue = 2;
	    ig.global.currentValue = 13;	    
	},
	
	postInit: function()
	{
	    var validPicks = ig.game.getEntitiesByType(EntityPickObject);
	    
	    for (var i = 0; i < validPicks.length; ++i)
	    {
		if (validPicks[i].pickType == ig.global.typeToPick)
		{
		    ig.global.validPicks++;
		}
	    }	    			
	},
	
        update: function()
        {
	    this.parent();
        },
        
	pausedUpdate: function()
	{
	    if (ig.input.state('enter'))
	    {
		this.defaultValues();		
		this.game.loadLevelDeferred(LevelPickInside);
	    }
	},
	
        draw: function()
        {
	    this.parent();
	    this.font.draw( 'Resultado atual: ' + ig.global.currentValue, 10, 445, ig.Font.ALIGN.LEFT );
	    //this.font.draw( 'Numero de ovelhas azuis: ' + ig.global.validPicks, 30, 460, ig.Font.ALIGN.LEFT );
	    
	    if (ig.global.desiredValue == ig.global.currentValue)
	    {
		this.font.draw( 'Parabens !!!', 190, 20, ig.Font.ALIGN.LEFT );
		this.font.draw( 'Voce conseguiu o numero correto.', 190, 36, ig.Font.ALIGN.LEFT );		
		this.font.draw( 'Pressione enter.', 190, 68, ig.Font.ALIGN.LEFT );
		ig.global.paused = true;
	    }
	    else if (ig.global.failed == true)
	    {
		this.font.draw( 'Ops... voce quase acertou...', 190, 20, ig.Font.ALIGN.LEFT );
		this.font.draw( 'Para tentar novamente pressione enter.', 190, 36, ig.Font.ALIGN.LEFT );		
		ig.global.paused = true;				
	    }
	    else
	    {
		this.font.draw( 'Voce deve obter o resultado: ' + ig.global.desiredValue, 190, 20, ig.Font.ALIGN.LEFT );
		this.font.draw( 'Operacao: ' + ig.global.mathOperator, 190, 36, ig.Font.ALIGN.LEFT );
	    }
        }       
    });
});